<?php

use yii\helpers\Html;
use yii\widgets\LinkPager;
use yii\helpers\Url;

/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '所有话题列表 - ' . Yii::$app->params['site_name'];
$title = " 话题";
$this->params['breadcrumbs'][] = $title;
?>
<div class="topic-index row">

    <div class="col-md-9 topic-main">
        <h1>话题</h1>
        <br />
        <?php
        $tags_merge = array_merge($download_tags, $post_tags);

        $tags = array();
        foreach ($tags_merge as $value) {
            if (strpos($value['tag'], ';') !== false) {
                $multi_tag = explode(';', $value['tag']);
                $tags = array_merge($multi_tag, $tags);   //合并多词tag
            } else {
                $tags[] = trim($value['tag']);
            }
        }
        $tags_arr = array_unique($tags);    //  数组去重

        foreach ($tags_arr as $value) {
            if (!empty($value)) {
                echo Html::a($value, Url::toRoute($slug.'/topic/' . $value)) . "&nbsp;&nbsp;";
            }
        }
//        var_dump($post_tags);   
        ?>
    </div>
    <div class="col-md-3">
        <div class="list-group mt30">
            <?php
            $category = \common\components\CategoryHelper::category_widget($cid);
            foreach ($category as $value) {
                echo Html::a($value['title'], Url::toRoute('post/topic-' . $value['id']), ['class' => 'list-group-item']);
            }
            ?>
        </div>
    </div>   
</div>
